package com.jd.basic.enm;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum ShopStateEnum {

    WAIT_AUDIT(0, "待审核"),
    WAIT_ACTIVE(1, "待激活"),
    HAVING_ACTIVE(2, "已激活"),
    NO_AUDIT(3, "驳回"),
    ;
    public static String getNameByCode(int code) {
        Optional<ShopStateEnum> first = Arrays.stream(ShopStateEnum.values())
                .filter(en -> en.getCode() == code).findFirst();
        if (!first.isPresent()) {
            return "";
        }
        return first.get().getName();
    }
    // code值
    private int code;
    // 名称
    private String name;
}
